/***************************************************************************

Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

***************************************************************************/

using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.Package;
using Babel.Parser;
using Microsoft.VisualStudio.TextManager.Interop;

namespace Babel
{
	public static partial class Configuration
	{
        public const string Name = "MyApexParser";
        public const string Extension = ".apex";

        static CommentInfo myCInfo;
        public static CommentInfo MyCommentInfo { get { return myCInfo; } }

        static Configuration()
        {
            myCInfo.BlockEnd = "*/";
            myCInfo.BlockStart = "/*";
            myCInfo.LineStart = "??";
            myCInfo.UseLineComments = false;

            // default colors - currently, these need to be declared
            CreateColor("Keyword", COLORINDEX.CI_BLUE, COLORINDEX.CI_USERTEXT_BK);
            CreateColor("Comment", COLORINDEX.CI_DARKGREEN, COLORINDEX.CI_USERTEXT_BK);
            CreateColor("Identifier", COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_USERTEXT_BK);
            CreateColor("String", COLORINDEX.CI_MAROON, COLORINDEX.CI_USERTEXT_BK);
            CreateColor("Number", COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_USERTEXT_BK);
            CreateColor("Text", COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_USERTEXT_BK);

            var sqllitColor = CreateColor("SqlLit", COLORINDEX.CI_BROWN, COLORINDEX.CI_USERTEXT_BK, true, false);
            var arrayindexColor = CreateColor("arrayindexColor", COLORINDEX.CI_USERTEXT_FG, COLORINDEX.CI_USERTEXT_BK, true, false);

            TokenColor error = CreateColor("Error", COLORINDEX.CI_RED, COLORINDEX.CI_USERTEXT_BK, false, true);

            var variableTypeColor = CreateColor("variableTypeColor", COLORINDEX.CI_PURPLE, COLORINDEX.CI_USERTEXT_BK, false, false);

            
            //
            // map tokens to color classes
            //

            ColorToken((int)Tokens.KWIF, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWELSE, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWWHILE, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWFOR, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWBREAK, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWRETURN, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWINTEGER, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWLONG, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWDOUBLE, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWSTRING, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWDATE, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWTIME, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWDATETIME, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWID, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWOBJECT, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWBOOLEAN, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWLIST, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWSET, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            ColorToken((int)Tokens.KWMAP, TokenType.Keyword, variableTypeColor, TokenTriggers.None);
            
            ColorToken((int)Tokens.KWVOID, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWNEW, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWVALUEOF, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWSTATIC, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWABSTRACT, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWVIRTUAL, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWPUBLIC, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWPRIVATE, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWPROTECTED, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWGLOBAL, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWTRUE, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWFALSE, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWNULL, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.KWCLASS, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWEXTENDS, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);


            ColorToken((int)Tokens.KWWEBSERVICE, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWTESTMETHOD, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWENUM, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);



            

            
            ColorToken((int)Tokens.KWTRY, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWCATCH, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);
            ColorToken((int)Tokens.KWTHROW, TokenType.Keyword, TokenColor.Keyword, TokenTriggers.None);

            ColorToken((int)Tokens.NUMBER, TokenType.Literal, TokenColor.Number, TokenTriggers.None);
            ColorToken((int)Tokens.FLOAT, TokenType.Literal, TokenColor.Number, TokenTriggers.None);
            ColorToken((int)Tokens.STRINGLIT, TokenType.Literal, TokenColor.String, TokenTriggers.None);

            ColorToken((int)Tokens.GT, TokenType.Operator, TokenColor.Text, TokenTriggers.None);
            ColorToken((int)Tokens.LT, TokenType.Operator, TokenColor.Text, TokenTriggers.None);
            ColorToken((int)Tokens.LTE, TokenType.Operator, TokenColor.Text, TokenTriggers.None);
            ColorToken((int)Tokens.GTE, TokenType.Operator, TokenColor.Text, TokenTriggers.None);
            ColorToken((int)Tokens.EQ, TokenType.Operator, TokenColor.Text, TokenTriggers.None);
            ColorToken((int)Tokens.NEQ, TokenType.Operator, TokenColor.Text, TokenTriggers.None);

            ColorToken((int)'[', TokenType.Delimiter, TokenColor.Text, TokenTriggers.MatchBraces);
            ColorToken((int)']', TokenType.Delimiter, TokenColor.Text, TokenTriggers.MatchBraces);

            ColorToken((int)'(', TokenType.Delimiter, TokenColor.Text, TokenTriggers.MatchBraces);
            ColorToken((int)')', TokenType.Delimiter, TokenColor.Text, TokenTriggers.MatchBraces);
            ColorToken((int)'{', TokenType.Delimiter, TokenColor.Text, TokenTriggers.MatchBraces);
            ColorToken((int)'}', TokenType.Delimiter, TokenColor.Text, TokenTriggers.MatchBraces);

            //// Extra token values internal to the scanner
            ColorToken((int)Tokens.LEX_ERROR, TokenType.Text, error, TokenTriggers.None);
            ColorToken((int)Tokens.LEX_COMMENT, TokenType.Text, TokenColor.Comment, TokenTriggers.None);

            ColorToken((int)Tokens.SQLLIT, TokenType.Literal, sqllitColor, TokenTriggers.None);
            ColorToken((int)Tokens.ARRAYINDEX, TokenType.Text, arrayindexColor, TokenTriggers.None);

            
            

        }
    }
}